package com.scs.application.modules.wm.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scs.application.core.entity.FlowEntity;
import com.scs.application.modules.upgrade.db.annotation.EntityClassAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityFieldAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityIndexAnnotation;
import com.scs.application.modules.upgrade.db.enums.EntityFieldType;
import com.scs.application.modules.wm.enums.WorkOrderType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * <p>
 *
 * </p>
 */
@Data
@Accessors(chain = true)
@EntityClassAnnotation(remark = "调拨表")
@TableName("wm_transfer")
@EntityIndexAnnotation(ux = {"bus_key"}, ix = {"to_warehouse_id", "settlement_type", "type"})
public class Transfer extends FlowEntity {

    @EntityFieldAnnotation(
            text = "调拨单号",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String busKey;

    @EntityFieldAnnotation(
            text = "日期",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Date busDate;

    @EntityFieldAnnotation(
            text = "经手人",
            length = "20",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String busUser;

    @EntityFieldAnnotation(
            text = "经手人工号",
            length = "20",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String busUserCode;

    // id ,在父类中处理

    @EntityFieldAnnotation(
            text = "调出仓库ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String fromWarehouseId;

    @TableField(exist = false)
    private String fromWarehouseNamePy;

    @EntityFieldAnnotation(
            text = "调出仓库名称",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String fromWarehouseName;

    @EntityFieldAnnotation(
            text = "调入仓库ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String toWarehouseId;

    @EntityFieldAnnotation(
            text = "调入仓库名称",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String toWarehouseName;

    @TableField(exist = false)
    private String toWarehouseNamePy;

    /**
     * 调拨金额
     */
    @EntityFieldAnnotation(
            text = "金额",
            length = "",
            not_null = true,
            default_value = "0",
            comment = ""
    )
    private Double amount;

    @EntityFieldAnnotation(
            text = "备注",
            length = "200",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String remark;

    @EntityFieldAnnotation(
            text = "日期",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    @TableField(strategy=FieldStrategy.IGNORED)
    private Date pickDate;


    @EntityFieldAnnotation(
            text = "经手人",
            length = "20",
            not_null = false,
            default_value = "",
            comment = ""
    )
    @TableField(strategy= FieldStrategy.IGNORED)
    private String picker;
    @EntityFieldAnnotation(
            text = "来源库位id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = "来源库位id"
    )
    private String fromLocationId;

    @EntityFieldAnnotation(
            text = "来源库位名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = "来源库位名称"
    )
    private String fromLocationName;
    @EntityFieldAnnotation(
            text = "目的库位id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = "目的库位id"
    )
    private String toLocationId;

    @EntityFieldAnnotation(
            text = "目的库位名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = "目的库位名称"
    )
    private String toLocationName;


    // creator ,在父类中处理


    // gmt_create ,在父类中处理


    // modifier ,在父类中处理


    // gmt_modified ,在父类中处理

    // id ,在父类中处理

    @EntityFieldAnnotation(
            text = "调入科室ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = "调入科室ID"
    )
    private String deptIdTo;

    @EntityFieldAnnotation(
            text = "调入科室名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = "调入科室名称"
    )
    private String deptNameTo;

    //科室地址
    @TableField(exist = false)
    private String deptAddressName;
    //申领人
    @TableField(exist = false)
    private String applyUsers;

    @EntityFieldAnnotation(
            text = "分类",
            length = "10",
            not_null = false,
            default_value = "matr",
            comment = "matr:耗材，reagent：试剂，drugs：药品"
    )
    private String transferType;

    @EntityFieldAnnotation(
            text = "试剂组id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = ""
    )
    private String reagentTeamId;

    @EntityFieldAnnotation(
            text = "调拨类型",
            length = "20",
            not_null = true,
            default_value = WorkOrderType.OUT_SHIFT
    )
    private String type;

    @EntityFieldAnnotation(
            text = "结算类型",
            length = "10",
            not_null = true,
            default_value = "used"
    )
    private String settlementType;

    @EntityFieldAnnotation(
            text = "科室ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String deptIdFrom;

    @EntityFieldAnnotation(
            text = "科室名称",
            length = "50",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String deptNameFrom;

    @EntityFieldAnnotation(
            text = "序列号",
            length = "10",
            not_null = false,
            comment = "业务审核之后的序列号，打印对单使用"
    )
    private Integer serialNum;

    @EntityFieldAnnotation(
            text = "单据来源",
            length = "20",
            default_value = "manual",
            not_null = true,
            comment = "dept_apply_auto:由二级库配送需求转换过来的,manual:手动创建的"
    )
    private String sourceType;

    // 试剂组名称
    @TableField(exist = false)
    private String reagentTeamName;


    // 明细数量
    @TableField(exist = false)
    private int countDtl;

    // 明细数量
    @TableField(exist = false)
    private int countDemand;
}
